import random

choices = ["石头", "剪刀", "布"]

print("石头剪刀布游戏!")
user_choice = input("请选择(石头/剪刀/布): ").strip()

if user_choice not in choices:
    print("无效的选择!")
else:
    computer_choice = random.choice(choices)
    print(f"电脑选择了: {computer_choice}")
    
    if user_choice == computer_choice:
        print("平局!")
    elif (user_choice == "石头" and computer_choice == "剪刀") or \
         (user_choice == "剪刀" and computer_choice == "布") or \
         (user_choice == "布" and computer_choice == "石头"):
        print("你赢了!")
    else:
        print("电脑赢了!")